package com.bjsxt.service.impl;

import com.bjsxt.mapper.CompanyMapper;
import com.bjsxt.pojo.Company;
import com.bjsxt.pojo.PageA;
import com.bjsxt.service.CompanyService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class CompanyServiceImpl implements CompanyService {
    @Autowired
    private CompanyMapper companyMapper;
    /*按条件查询公司信息*/
    @Override
    public PageA<Company> selectFindMore(Integer page, Integer rows,Company company) {
        Page pg= PageHelper.startPage(page, rows);
        List<Company>list = companyMapper.selectFindMore(company);

        PageA<Company> pga=new  PageA<Company>(list,pg.getTotal());
        return pga;
    }
   //添加公司的信息
    @Override
    public Integer saveCompany(Company company) {
        return  companyMapper.insert(company);
    }
    //修改公司的信息
    @Override
    public Integer update(Company company) {
        return companyMapper.update(company);
    }
}
